In [1]:
%matplotlib inline
# Exchange inline for notebook or qt5 (from pyqt) for interactive plotting
%matplotlib inline

import matplotlib.pyplot as plt
import numpy as np
import pyvista

from diffpy.structure import Atom, Lattice, Structure
from diffsims.crystallography import ReciprocalLatticeVector
import hyperspy.api as hs
import kikuchipy as kp
from orix.crystal_map import Phase


# Plotting parameters
plt.rcParams.update(
    {"figure.figsize": (10, 10), "font.size": 20, "lines.markersize": 10}
)
# See https://docs.pyvista.org/user-guide/jupyter/index.html
pyvista.set_jupyter_backend("panel")
/var/folders/ck/qbl12k012sj44wnxw8vxxjxdk_xfc4/T/ipykernel_92920/844353216.py:21: PyVistaDeprecationWarning: `panel` backend is deprecated and is planned for future removal.
  pyvista.set_jupyter_backend("panel")
In [2]:
#NGOstructure = loadStructure('NGO_orthorhombic.cif')
#NGOstructure.point_group='P1'



# phase_sigma = Phase(
#     name="sigma",
#     space_group=136,
#     structure=Structure(
#         atoms=[
#             Atom("Cr", [0, 0, 0], 0.5),
#             Atom("Fe", [0, 0, 0], 0.5),
#             Atom("Cr", [0.31773, 0.31773, 0], 0.5),
#             Atom("Fe", [0.31773, 0.31773, 0], 0.5),
#             Atom("Cr", [0.06609, 0.26067, 0], 0.5),
#             Atom("Fe", [0.06609, 0.26067, 0], 0.5),
#             Atom("Cr", [0.13122, 0.53651, 0], 0.5),
#             Atom("Fe", [0.13122, 0.53651, 0], 0.5),
#         ],
#         lattice=Lattice(8.802, 8.802, 4.548, 90, 90, 90),
#     ),
# )
# phase_sigma
In [3]:
phase_ngo = Phase (
    name='ngo',
    space_group=136,
    structure=Structure(
        atoms=[
            Atom("Nd", [0.49087, 0.04268, 0.25], 0.5),
            Atom("Ga", [0, 0, 0.5], 0.5),
            Atom("O", [0.7098, 0.2092, 0.5426], 0.5),
            Atom("O", [0.0803, 0.0181, 0.75], 0.5),
        ],
        lattice=Lattice( 5.4176, 5.4952, 7.6871, 90, 90, 90)
    ),
)   
In [4]:
rlv_ngo = ReciprocalLatticeVector.from_min_dspacing(phase_ngo, 1)

rlv_ngo.sanitise_phase()

rlv_ngo.calculate_structure_factor("lobato")

structure_factor = abs(rlv_ngo.structure_factor)
rlv_ngo = rlv_ngo[structure_factor > 0.05 * structure_factor.max()]

rlv_ngo.calculate_theta(20e3)
In [5]:
simulator_ngo = kp.simulations.KikuchiPatternSimulator(rlv_ngo)
simulator_ngo.reflectors.size
Out[5]:
290
In [6]:
fig = simulator_ngo.plot(
    hemisphere="both", mode="bands", return_figure=True
)

ax = fig.axes[0]
ax.scatter(simulator_ngo.phase.a_axis, c="r")
ax.scatter(simulator_ngo.phase.b_axis, c="g")
ax.scatter(simulator_ngo.phase.c_axis, c="b")
fig.tight_layout()
In [7]:
simulator_ngo.plot("spherical", mode="bands", backend="pyvista")
In [8]:
simulator_ngo.plot("spherical", mode="bands", backend="pyvista")
In [9]:
simulator_ngo.plot("spherical", mode="bands", backend="pyvista")
In [ ]:
 
In [11]:
#mp_ngo = simulator_ngo.calculate_master_pattern()
#mp_ngo.plot()
In [12]:
# Interactive!
#mp_ngo.plot_spherical(style="points")
In [ ]: